UNPKG

marko

Version:

UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.

17 lines (14 loc) 726 B
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = _default;var _compiler = require("@marko/compiler"); var _htmlOutWrite = _interopRequireDefault(require("../util/html-out-write")); var _withPreviousLocation = _interopRequireDefault(require("../util/with-previous-location")); const ieConditionalCommentRegExp = /^\[if |<!\[endif\]$/; function _default(path) { const { node } = path; if (ieConditionalCommentRegExp.test(node.value)) { path.replaceWith( (0, _withPreviousLocation.default)((0, _htmlOutWrite.default)`<!--${_compiler.types.stringLiteral(node.value)}-->`, node) ); } else { path.remove(); } }